package com.screen.screendisplay.service.impl.ne;

import com.screen.screendisplay.entity.ne.NeProdoperElectricEff;
import com.screen.screendisplay.mapper.ne.NeProdoperElectricEffMapper;
import com.screen.screendisplay.service.ne.NeProdoperElectricEffService;
import com.screen.screendisplay.vo.ne.NeElectricEfficiencyVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 电力生产效率表 服务实现类
 * </p>
 *
 * @author xuesong
 * @since 2025-08-23
 */
@Service
public class NeProdoperElectricEffServiceImpl extends ServiceImpl<NeProdoperElectricEffMapper, NeProdoperElectricEff> implements NeProdoperElectricEffService {

    @Autowired
    private NeProdoperElectricEffMapper neProdoperElectricEffMapper;

    @Override
    public List<NeElectricEfficiencyVO> getElectricProductionEfficiency(Integer year) {
        List<NeProdoperElectricEff> dataList = neProdoperElectricEffMapper.selectDailyEfficiencyData(20);
        return dataList.stream().map(data -> {
            NeElectricEfficiencyVO vo = new NeElectricEfficiencyVO();
            vo.setYear(data.getYear());
            vo.setMonth(data.getMonth());
            vo.setDay(data.getDay());
            vo.setDate(data.getDate());
            vo.setFanOperationHour(data.getFanOperationHour());
            vo.setPvOperationHour(data.getPvOperationHour());
            return vo;
        }).collect(Collectors.toList());
    }
}
